namespace Management.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class test : DbMigration
    {
        public override void Up()
        {
            CreateIndex("dbo.AdminRoles", "RoleID");
            CreateIndex("dbo.AdminRoles", "AdminID");
            AddForeignKey("dbo.AdminRoles", "AdminID", "dbo.Admins", "AdminID", cascadeDelete: true);
            AddForeignKey("dbo.AdminRoles", "RoleID", "dbo.Roles", "RoleID", cascadeDelete: true);
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.RoleAdminRoles",
                c => new
                    {
                        Role_RoleID = c.Int(nullable: false),
                        AdminRole_AdminRoleID = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.Role_RoleID, t.AdminRole_AdminRoleID });
            
            CreateTable(
                "dbo.AdminRoleAdmins",
                c => new
                    {
                        AdminRole_AdminRoleID = c.Int(nullable: false),
                        Admin_AdminID = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.AdminRole_AdminRoleID, t.Admin_AdminID });
            
            DropForeignKey("dbo.AdminRoles", "RoleID", "dbo.Roles");
            DropForeignKey("dbo.AdminRoles", "AdminID", "dbo.Admins");
            DropIndex("dbo.AdminRoles", new[] { "AdminID" });
            DropIndex("dbo.AdminRoles", new[] { "RoleID" });
            CreateIndex("dbo.RoleAdminRoles", "AdminRole_AdminRoleID");
            CreateIndex("dbo.RoleAdminRoles", "Role_RoleID");
            CreateIndex("dbo.AdminRoleAdmins", "Admin_AdminID");
            CreateIndex("dbo.AdminRoleAdmins", "AdminRole_AdminRoleID");
            AddForeignKey("dbo.RoleAdminRoles", "AdminRole_AdminRoleID", "dbo.AdminRoles", "AdminRoleID", cascadeDelete: true);
            AddForeignKey("dbo.RoleAdminRoles", "Role_RoleID", "dbo.Roles", "RoleID", cascadeDelete: true);
            AddForeignKey("dbo.AdminRoleAdmins", "Admin_AdminID", "dbo.Admins", "AdminID", cascadeDelete: true);
            AddForeignKey("dbo.AdminRoleAdmins", "AdminRole_AdminRoleID", "dbo.AdminRoles", "AdminRoleID", cascadeDelete: true);
        }
    }
}
